//package com.example.recordingpen_datacollection.Aliyun;
//
//import com.alibaba.fastjson.JSON;
//import okhttp3.*;
//
//import java.io.IOException;
//import java.util.ArrayList;
//import java.util.HashMap;
//import java.util.List;
//import java.util.Map;
//
//public class Apitest_HTML {
//
//    public static String  getBDtoken() throws IOException {
//
//        //{
//        //    "model": "$YOUR_ENDPOINT_ID",
//        //    "messages": [
//        //      {
//        //        "role": "system",
//        //        "content": "You are a helpful assistant."
//        //      },
//        //      {
//        //        "role": "user",
//        //        "content": "Hello!"
//        //      }
//        //    ],
//        //    "stream": true
//        //  }'
//        String messages = "{\"model\":\"ep-20240516011401-g68qw\",\"messages\":[{\"role\":\"system\",\"content\":\"You are a helpful assistant.\"},{\"role\":\"user\",\"content\":\"今天星期几\"}],\"stream\":false}";
//        String messagessss = "[{\"role\":\"system\",\"content\":\"You are a helpful assistant.\"},{\"role\":\"user\",\"content\":\"今天星期几\"}]";
//        List<Map<String,String>> maps = new ArrayList<>();
//        Map<String,String> map = new HashMap<>();
//        map.put("role","system");
//        map.put("content","You are a helpful assistant.");
//        maps.add(map);
//        Map<String,String> map2 = new HashMap<>();
//        map2.put("role","user");
//        map2.put("content","今天星期几");
//        maps.add(map2);
//        Map<String,Object>  aliYunJsonRoot = new HashMap<String,Object>();
//        aliYunJsonRoot.put("model","ep-20240516011401-g68qw");
//        aliYunJsonRoot.put("messages",maps);
//        aliYunJsonRoot.put("stream",false);
//
//        System.out.println(messages);
//        String jsonInputString = JSON.toJSONString(aliYunJsonRoot);
//        System.out.println(jsonInputString);
//
//        RequestBody body = RequestBody.create(jsonInputString, MediaType.parse("application/json"));
//
//        String api = "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJhcmstY29uc29sZSIsImV4cCI6MTcxODQzOTc3NiwiaWF0IjoxNzE1OTM0MTc2LCJ0IjoidXNlciIsImt2IjoxLCJhaWQiOiIyMTAwNDcyNTU3IiwidWlkIjoiMCIsImlzX291dGVyX3VzZXIiOnRydWUsInJlc291cmNlX3R5cGUiOiJlbmRwb2ludCIsInJlc291cmNlX2lkcyI6WyJlcC0yMDI0MDUxNjAxMTQwMS1nNjhxdyJdfQ.ky_W-m8ao6P-hTu9jl_09tjvGZfdrplnl73IW0zBhZakYM-86Qe531BW2-_e2p2K7mbmF8bRZnq_7EeNwh100Rwvv-AeS6S4rLkegdjb-pSdSKSX1FfMWOZxBlw1V9WVNHKf3Uj568dHsNc64T-y1lWqY90VMaGpHXFWy_mAht57nFPUghvaQevdst2Xce0du9bQa7CUsozWfJ-LQCqRlq-hS8e_1rvAz_EkbHBQlPdGpMu8PmYnRbcxt-YoL8QxZd6PteEaAvm1sAHSmPHtQ4BONVt88fGzkkZbn0Tu3Zu89NMg6kJCdQPGwZ5TVy6zB3YdPN_RtZUGeUkkHygqKA";
//        OkHttpClient client = new OkHttpClient();
//        Request request = new Request.Builder()
//                .addHeader("Content-Type","application/json")
//                .addHeader("Authorization","Bearer "+api)
//                .url("https://ark.cn-beijing.volces.com/api/v3/chat/completions")
//                .post(body)
//                .build();
//        try (Response response = client.newCall(request).execute()) {
//            return (response.body().string());
//        }
//    }
//
//    public static void main(String[] args) {
//        String bDtoken = null;
//        try {
//            bDtoken = Apitest_HTML  .getBDtoken();
//        } catch (IOException e) {
//            e.printStackTrace();
//        }
//        System.out.println(bDtoken);
//    }
//}
